package com.hmys.api.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hmys.api.mapper.WebJobMapper;
import com.hmys.api.model.WebJob;
import com.hmys.api.model.WebNews;
import com.hmys.api.service.WebJobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * Created by chen365 on 2018/03/23.
 */
@Service
public class WebJobServiceImpl implements WebJobService {
    @Autowired
    private WebJobMapper webJobMapper;


    @Override
    public PageInfo<WebJob> selectByBean(Integer pageIndex, Integer pageSize,WebJob record) {
        if (StringUtils.isEmpty(pageIndex) || pageIndex < 1) {
            pageIndex = 1;
        }
        if (StringUtils.isEmpty(pageSize) || pageSize < 1) {
            pageSize = 10;
        }
        PageHelper.startPage(pageIndex, pageSize);
        List<WebJob> list = webJobMapper.selectByBean(record);
        return new PageInfo<>(list);
    }

    @Override
    public WebJob selectByPrimaryKey(Integer id) {
        return webJobMapper.selectByPrimaryKey(id);
    }
}
